﻿@model MVC_basic.Models.App

@{
    ViewBag.Title = "Edit";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h1 class="subheader">Edit Your App</h1>


<script src="@Url.Content("~/Scripts/jquery-1.7.1.min.js")"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")"></script>




    <fieldset>
        <legend>Edit App</legend>

        <div class="editor-field">
            @Html.LabelFor(model => model.id)
            @Html.TextBoxFor(model => model.id, new { disabled="disabled", @readonly = "readonly" })
            @Html.ValidationMessageFor(model => model.name)
        </div>
        
        @using (Html.BeginForm(Model.appType, "EditApp", FormMethod.Post, new {enctype = "multipart/form-data" }))
        {
            Html.ValidationSummary(true);
            @Html.Hidden("id", Model.id)
            if (Model.appType == "Canvas")
            { 
                Html.RenderPartial("~/Views/CreateApp/CanvasApp.cshtml", (MVC_basic.ViewModels.CanvasAppViewModel)ViewBag.vm); 
            }
            else
            {
                { Html.RenderPartial("~/Views/CreateApp/CajaApp.cshtml", (MVC_basic.ViewModels.CajaAppViewModel)ViewBag.vm); }
            }
            <p>
                <input type="submit" name="command" value="save" />
            </p>
            <p>
                <input type="submit" name="command" value="delete" />
            </p>
        }
        
    </fieldset>